package com.example.jiangkt.ergongyi.util;

import android.app.ProgressDialog;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by jiangkt on 2018/3/3.
 */

public class AlertShow {
    public static ProgressDialog dialog;

    public static boolean isMobileNO(String mobiles) {
        Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
        Matcher m = p.matcher(mobiles);
        return m.matches();
    }

    public static boolean isEmail(String email) {
        Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");//复杂匹配
        Matcher m = p.matcher(email);
        return m.matches();
    }

    public static boolean isPassword(String password) {
        Pattern p = Pattern.compile("(?!^\\d+$)(?!^[a-zA-Z]+$)(?!^[._!@#]+$).{8,16}");//8-16位，至少含数字/字母/字符2种组合
        Matcher m = p.matcher(password);
        return m.matches();
    }

    public static boolean isEmailCode(String emailCode) {
        Pattern p = Pattern.compile("^\\d{6}$");//8-16位，至少含数字/字母/字符2种组合
        Matcher m = p.matcher(emailCode);
        return m.matches();
    }

    public static boolean isUserName(String userName) {
        Pattern p = Pattern.compile("([A-Za-z]|[\\u4e00-\\u9fa5]){3,8}");
        Matcher m = p.matcher(userName);
        return m.matches();
    }
}
